/*
 * @brief: 电磁铁纱嘴驱动
 */
 #include "stdio.h"
#include "em_yc.h"
#include "mhdef.h"
#include "dispatch.h"
//#include "globe.h"

/*
 * @param type: 动作类型
 * @param state: 0-左机头左系统纱嘴
 *               1-左机头右系统纱嘴
 *               2-右机头右系统纱嘴
 *               3-右机头右系统纱嘴
 */
int emyc_exec(MH_UDP *pudp, ActType type, uchar *state)
{
    CAN_MSG msg = { 0, 0, { 0 } };
    msg.id = (type == RESET) ? ID_YC_RESET : ID_YC;
    msg.len = 4;
    msg.data[0] = state[0];
    msg.data[1] = state[1];
    msg.data[2] = state[2];
    msg.data[3] = state[3];

    return dispatch_msg(pudp, &msg, NULL);
}
